<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no,maximum-scale=1.0,minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        div {
            width: 200px;
            height: 100px;
            background-color: red;
            

        }
    </style>
</head>

<body>
    <div class="box"> </div>
    <div class="box"> </div>
    <div class="box"> </div>
    <div class="box"> </div>
    <div class="box"> </div>
    <div class="box"> </div>
    <div class="box"> </div>
    <script>
        window.onload = function () {
            var box = document.querySelector('.box')
            var startX, startY, moveX, moveY, distanceX, distanceY;
            document.addEventListener('touchstart',function(e){
                startX = e.targetTouches[0].clientX;
                startY = e.targetTouches[0].clientY;
                console.log('startX');
                
            });
            document.addEventListener('touchmove',function(e){
                moveX = e.targetTouches[0].clientX;
                moveY = e.targetTouches[0].clientY;
                console.log('moveX');

                distanceX = moveX - startX;
                distanceY = moveY - startY;
                e.target.style.transform='translate('+distanceX+'px,' + distanceY +'px)' 
            });
            // document.addEventListener('touchend',function(e){
            //     // distanceX = e.changedTouches[0].clientX;
            //     // distanceY = e.changedTouches[0].clientY;
            //     console.log('distanceX');

            // });
        }
    </script>
</body>

</html>